package com.zx._12_算法.数据结构.bitmap;

/**
 * @version v1.0
 * @Project: knowledge
 * @Title: Demo2  两个集合取交集（普通模式）
 * @Description: 两个数组，内容分别为[1, 4, 6, 8, 9, 10, 15], [6, 14, 9, 2, 0, 7]，请用BitMap计算他们的交集
 * @author: zhangxue
 * @date: 2019年8月4日下午7:22:52
 * @company: 未知之地
 * @Copyright: Copyright (c) 2019
 */
public class Demo2 {

    public static void main(String[] args) {
        int[] data1 = {1, 4, 6, 8, 9, 10, 15};
        int[] data2 = {6, 14, 9, 2, 0, 7};
        BitMap bitMap = new BitmapImpl1();

        for (int i = 0; i < data1.length; i++) {
            bitMap.addMember(data1[i]);
        }

        for (int i = 0; i < data2.length; i++) {
            boolean exist = bitMap.isExist(data2[i]);
            if (exist) {
                System.out.println(data2[i]);
            }
        }


    }
}
